package CtrLayer;

import java.sql.Timestamp;
import java.util.ArrayList;

import ModelLayer.*;
import DBLayer.*;

public class CtrComment {
	private IFDBComment dbCom;

	public CtrComment() {
		dbCom = DBComment.getInstance();
	}

	public ArrayList<Comment> getAllComments(boolean forPeople) {
		return dbCom.getAllComments(forPeople);
	}

	public ArrayList<Comment> getComments_byID(int pid, boolean forPeople) {
		return dbCom.getComments_byID(pid, forPeople);
	}

	public Comment getComment_byID(int cid) {
		return dbCom.getComment_byID(cid);
	}
	
	public int insert(Comment comm, boolean forPeople) {
		return dbCom.insert(comm, forPeople);
	}
	
	public int insert(int cid, String comment, int authorId, Timestamp date, boolean forPeople) {
		return dbCom.insert(new Comment(-1, comment, authorId, date), forPeople);
	}

	public int update(int cid, String comment, int authorId, Timestamp date, boolean forPeople) {
		return dbCom.update(new Comment(cid, comment,authorId, date));
	}

	public int delete(int cid) {
		return dbCom.delete(cid);

	}
}
